import { aggregate1 } from './materialAggregate/aggregate1';
import { aggregate2 } from './materialAggregate/aggregate2';
import { aggregate3 } from './materialAggregate/aggregate3';
import { aggregate4 } from './materialAggregate/aggregate4';
import { aggregate5 } from './materialAggregate/aggregate5';
import { aggregate6 } from './materialAggregate/aggregate6';
import { MaterialListType } from './type';
import { publicUrls } from '@/utils/minxin';
import _ from 'lodash';
const webUrls: string = '?imageView2/3/format/webp';
import { useProjectStore, commonDataStore } from '@/store';
  
export const materialList: Array<MaterialListType> = [  
  aggregate1, 
  aggregate2, 
  aggregate3, 
  aggregate4,
  aggregate5,
  aggregate6,
]; //所有素材列表
export const firstLevelOutlineList: Array<any> = [...aggregate1.firstLevelOutline]; //一级大纲素材列表
export const secondLevelOutlineList: Array<any> = [...aggregate1.secondLevelOutline]; //二级大纲素材列表
export const threeLevelOutlineList: Array<any> = [...aggregate1.threeLevelOutline]; //三级大纲素材列表
export const auxiliaryList: Array<any> = [...aggregate1.auxiliary]; //辅助信息素材列表
export const ExhibitionList: Array<any> = [
  ...aggregate1.exhibitionList,
  ...aggregate2.exhibitionList,
  ...aggregate3.exhibitionList,
  ...aggregate4.exhibitionList,
  ...aggregate5.exhibitionList,
  ...aggregate6.exhibitionList,
]; //展品素材列表
export const sceneBackgroundList = [publicUrls + 'free/sceneBackground/freeBg1.jpg' + webUrls]; //背景列表
export const sceneTwoBackgroundList = [publicUrls + 'free/sceneBackground/freeBg2-1.png' + webUrls]; //背景列表
export const sceneFourBackgroundList = [publicUrls + 'free/sceneBackground/freeBg4-1.png' + webUrls]; //背景列表
export const sceneAll = [
  publicUrls + 'free/sceneBackground/freeBg1.jpg' + '?imageView2/3/format/webp',
  publicUrls + 'free/sceneBackground/freeBg2-1.png' + '?imageView2/3/format/webp',
  publicUrls + 'free/sceneBackground/freeBg31.png' + '?imageView2/3/format/webp',
  publicUrls + 'free/sceneBackground/freeBg4-1.png' + webUrls,
  publicUrls + 'free/sceneBackground/freeBg51.png' + '?imageView2/3/format/webp',
  publicUrls + 'free/sceneBackground/freeBg6.png' + '?imageView2/3/format/webp',
  // publicUrls + 'free/sceneBackground/freeBg7.png' + '?imageView2/3/format/webp',
];
export const sceneAllList = [  
  {
    id: 546821049266245,
    list: [publicUrls + 'free/sceneBackground/freeBg1.jpg' + '?imageView2/3/format/webp'],
  },
  {
    id: 568727972499525,
    list: [publicUrls + 'free/sceneBackground/freeBg2-1.png' + '?imageView2/3/format/webp'],
  },
  {
    id: 581876609753157,
    list: [publicUrls + 'free/sceneBackground/freeBg31.png' + '?imageView2/3/format/webp'],
  },
  { 
    id: 584041224159301,
    list: [publicUrls + 'free/sceneBackground/freeBg4-1.png' + '?imageView2/3/format/webp'],
  }, 
  {
    id: 594187892883525, 
    list: [ 
      publicUrls + 'free/sceneBackground/freeBg51.png' + '?imageView2/3/format/webp',
      publicUrls + 'free/sceneBackground/freeBg52.jpg' + '', 
    ],  
  },  
  { 
    id: 598779929522245,
    list: [publicUrls + 'free/sceneBackground/freeBg6.png' + '?imageView2/3/format/webp'],
  },
  // {
  //   id: 607270742659141,
  //   list: [publicUrls + 'free/sceneBackground/freeBg7.png' + '?imageView2/3/format/webp'],
  // },
];
export const getOriginallyBg = (id: number) => {
  let bgc: string;
  switch (id) {
    case 546821049266245:
      bgc = sceneAll[0];
      break;
    case 568727972499525:
      bgc = sceneAll[1];
      break;
    case 581876609753157:
      bgc = sceneAll[2];
      break;
    case 584041224159301:
      bgc = sceneAll[3];
      break;
    case 594187892883525:
      bgc = sceneAll[4];  
      break;
    case 598779929522245:
      bgc = sceneAll[5];
      break;
    // case 607270742659141:
    //   bgc = sceneAll[6];
    //   break;
    default:
      bgc = sceneBackgroundList[0];
      break;
  }
  return bgc;
};
export const getBackgroundImageList = () => {
  let correlation = [];
  let Nocorrelation = [];
  const commonStore = commonDataStore();
  sceneAllList.forEach((el) => {
    if (el.id === commonStore.templateId) {
      correlation = el.list;
    } else {
      Nocorrelation = Nocorrelation.concat(el.list);
    }
  });
  return {
    correlationList: correlation,
    NocorrelationList: Nocorrelation,
  };
};
export const getmaterialTypeList = (id: number, type: number) => {
  let correlation = [];
  let Nocorrelation = [];
  const commonStore = commonDataStore();
  let list = materialList[0];
  let indexs = 0; //当前需要选中的下标
  if (commonStore.templateId === 546821049266245) {
    list = materialList[0];
    indexs = 0;
  } else if (commonStore.templateId === 568727972499525) {
    list = materialList[1];
    indexs = 1;
  } else if (commonStore.templateId === 581876609753157) {
    list = materialList[2];
    indexs = 2;
  } else if (commonStore.templateId === 584041224159301) {
    list = materialList[3];
    indexs = 3;
  } else if (commonStore.templateId === 594187892883525) {
    list = materialList[4];
    indexs = 4;
  } else if (commonStore.templateId === 598779929522245) {
    list = materialList[5];
    indexs = 5;
  }

  switch (type) {
    case 1:
      correlation = list.firstLevelOutline;
      // Nocorrelation
      materialList.forEach((element, index) => {
        if (indexs !== index) {
          Nocorrelation = Nocorrelation.concat(element.firstLevelOutline);
        }
      });
      break;
    case 2:
      correlation = list.secondLevelOutline;
      materialList.forEach((element, index) => {
        if (indexs !== index) {
          Nocorrelation = Nocorrelation.concat(element.secondLevelOutline);
        }
      });
      break;
    case 3:
      correlation = list.threeLevelOutline;
      materialList.forEach((element, index) => {
        if (indexs !== index) {
          Nocorrelation = Nocorrelation.concat(element.threeLevelOutline);
        }
      });
      break;
    case 4:
      correlation = list.auxiliary;
      materialList.forEach((element, index) => {
        if (indexs !== index) {
          Nocorrelation = Nocorrelation.concat(element.auxiliary);
        }
      });
      break;
    default:
      correlation = list.exhibitionList;
      materialList.forEach((element, index) => {
        if (indexs !== index) {
          Nocorrelation = Nocorrelation.concat(element.exhibitionList);
        }
      });
      break;
  }
  return {
    correlationList: correlation,
    NocorrelationList: Nocorrelation,
  };
};
export const getExhibitionType = (ActiveIId: number) => {
  //获取当前选中的type
  let str = 'displayBoard';
  ExhibitionList.forEach((el) => {
    if (el.id === ActiveIId) {
      str = el.type;
    }
  });
  return str;
};
export const getExhibitionItem = (id?: number) => {
  let item = {
    img: publicUrls + 'free/style1/cabinet1.png',
    disabledY: false,
    disabled: true,
    id: 15001,
    type: 'cabinet',
    showcaseWidth: 2.6458,
    showcaseHeight: 33.55,
    showcaseX: 0,
    showcaseY: 20,
    x: 0,
    y: 0,
    width: 2.8458,
    height: 38,
    exhibitionWidth: 1.632,
    exhibitionHeight: 13.666,
    resizable: true,
  };
  ExhibitionList.forEach((el) => {
    if (el.id === id) {
      item = el;
    }
  });
  return item;
};

export const setMaterialExhibitstyle = (item: any, ActiveId: number) => {
  //设置大纲选中样式
  let StyleItem = _.cloneDeep(item);
  let ActiveIndex = ExhibitionList.findIndex((el) => {
    return el.id == ActiveId;
  });

  StyleItem.type = ExhibitionList[ActiveIndex].id;
  //  console.log(ActiveId,'获取当前高度')
  StyleItem.height = ExhibitionList[ActiveIndex].height;
  StyleItem.y = ExhibitionList[ActiveIndex].y;

  StyleItem.showcaseWidth = ExhibitionList[ActiveIndex].showcaseWidth;
  StyleItem.showcaseHeight = ExhibitionList[ActiveIndex].showcaseHeight;
  StyleItem.showcaseX = ExhibitionList[ActiveIndex].showcaseX;
  StyleItem.showcaseY = ExhibitionList[ActiveIndex].showcaseY;
  StyleItem.showpieceList.forEach((element, index) => {
    element.imgWidth = ExhibitionList[ActiveIndex].CoverWidth;
    element.imgHeight = ExhibitionList[ActiveIndex].CoverHeight;
    element.width = ExhibitionList[ActiveIndex].CoverWidth;
    element.height = ExhibitionList[ActiveIndex].CoverHeight;
    element.showcaseX = ExhibitionList[ActiveIndex].showcaseX;
    element.showcaseY = ExhibitionList[ActiveIndex].showcaseY;

    element.x = ExhibitionList[ActiveIndex].CoverWidth * index;
  });
  if (ExhibitionList[ActiveIndex].type !== 'cabinet') {
    StyleItem.width =
      ExhibitionList[ActiveIndex].width + ExhibitionList[ActiveIndex].CoverWidth * item.showpieceList.length;
  }
  console.log(StyleItem);
  return StyleItem;
};
export const initMaterialExhibitstyle = (item: any, ActiveId: any, PreviousItem?: any) => {
  //设置大纲选中样式初始化专用
  let StyleItem = _.cloneDeep(item);
  let isexistence = -1;
  if (StyleItem.type) {
    //如果值存在的话进行遍历
    isexistence = ExhibitionList.findIndex((el) => {
      //默认选中id在其中的类型
      return el.id == StyleItem.type;
    });
  }
  let selectId = StyleItem.type && isexistence !== -1 ? StyleItem.type : ActiveId; //值存在切数值没问题则使用原来数值
  let ActiveIndex = ExhibitionList.findIndex((el) => {
    //默认选中id在其中的类型
    return el.id == selectId;
  });
  if (ActiveIndex === -1) {
    ActiveIndex = 0;
  } //追加逻辑
  StyleItem.type = StyleItem.type ? StyleItem.type : ActiveId;

  let StyleItemActiveIndex = ExhibitionList.findIndex((el) => {
    return el.id == StyleItem.type;
  }); //当前展品分组在查询列表中的index值
  if (StyleItemActiveIndex === -1) {
    StyleItemActiveIndex = 0;
  } //追加逻辑
  //  console.log(ActiveId,'获取当前高度')
  // console.log(StyleItemActiveIndex,'asdasdasdsa',StyleItem)
  StyleItem.height = StyleItem.height ? StyleItem.height : ExhibitionList[ActiveIndex].height;
  StyleItem.y = StyleItem.y ? StyleItem.y : ExhibitionList[ActiveIndex].y;
  StyleItem.x = StyleItem.x ? StyleItem.x : PreviousItem ? PreviousItem.width + PreviousItem.x : 0;
  let maxX = 0;
  StyleItem.showpieceList.forEach((element, index) => {
    StyleItem.showpieceList.forEach((elements) => {
      if (elements.x + elements.width > maxX) {
        maxX = elements.x + elements.width;
      }
    }); //优化新增展品位置移动逻辑
    element.imgWidth = element.imgWidth ? element.imgWidth : ExhibitionList[ActiveIndex].CoverWidth;
    element.imgHeight = element.imgHeight ? element.imgHeight : ExhibitionList[ActiveIndex].CoverHeight;
    element.width = element.width ? element.width : ExhibitionList[ActiveIndex].CoverWidth;
    element.height = element.height ? element.height : ExhibitionList[ActiveIndex].CoverHeight;
    // element.x = element.x ? element.x : ExhibitionList[ActiveIndex].CoverWidth * index //原来用来变换展品位置逻辑方法
    // if (element.x + element.width > maxX) {
    //   maxX = element.x + element.width;
    // }//原最大宽度配置位置
    element.x = element.x
      ? element.x
      : ExhibitionList[ActiveIndex].CoverWidth * index < maxX
      ? maxX
      : ExhibitionList[ActiveIndex].CoverWidth * index;
  });
  // console.log(ExhibitionList[StyleItemActiveIndex],'虎丘当前')
  if (ExhibitionList[StyleItemActiveIndex].type !== 'cabinet') {
    StyleItem.width =
      ExhibitionList[ActiveIndex].width + ExhibitionList[ActiveIndex].CoverWidth * item.showpieceList.length;
  } else {
    if (StyleItem.width < maxX) {
      StyleItem.width = maxX;
    }
  }
  if (StyleItem.showpieceList.length === 0) {
    StyleItem.width = 0;
  }
  return StyleItem;
};
const setOutlineStyle = (id: number, level: number) => {
  //设置各级大纲type

  const commonStore = commonDataStore();
  // const store = useProjectStore();
  // 581876609753157 第三套id
  let type;
  let index = 0;
  if (commonStore.templateId === 546821049266245) {
    index = 0;
  } else if (commonStore.templateId === 568727972499525) {
    index = 1;
  } else if (commonStore.templateId === 581876609753157) {
    index = 2;
  } else if (commonStore.templateId === 584041224159301) {
    index = 3;
  } else if (commonStore.templateId === 594187892883525) {
    index = 4;
  } else if (commonStore.templateId === 598779929522245) {
    index = 5;
  }

  if (level === 1) {
    //一级大纲
    type = materialList[index].firstLevelOutline[0].id;
  }
  if (level === 2) {
    type = materialList[index].secondLevelOutline[0].id;
    //二级大纲
  }
  if (level === 3) {
    type = materialList[index].threeLevelOutline[0].id;
    //三级大纲
  }
  if (level === 4) {
    type = materialList[index].auxiliary[0].id;
    //辅助大纲
  }
  return type;
};

const InitShowpieceType = (level) => {
  const commonStore = commonDataStore();
  if (commonStore.templateId === 546821049266245) {
    return materialList[0].exhibitionList[0].id;
  } else if (commonStore.templateId === 568727972499525) {
    return materialList[1].exhibitionList[0].id;
  } else if (commonStore.templateId === 581876609753157) {
    return materialList[2].exhibitionList[0].id;
  } else if (commonStore.templateId === 584041224159301) {
    return materialList[3].exhibitionList[0].id;
  } else if (commonStore.templateId === 594187892883525) {
    return materialList[4].exhibitionList[0].id;
  } else if (commonStore.templateId === 598779929522245) {
    return materialList[5].exhibitionList[0].id;
  }
};
const setShowpieceListType = (data, AllId?: number) => {
  //设置各级展品类型 AllId选中的应用到全部的值
  let list = _.cloneDeep(data);
  list.forEach((element, index) => {
    // if (element.type === 0) {
    let type = AllId ? AllId : InitShowpieceType(1);
    let arr;
    if (AllId) {
      arr = setMaterialExhibitstyle(element, type);
      // setMaterialExhibitstyle
    } else {
      if (index === 0) {
        arr = initMaterialExhibitstyle(element, type); //设置当前分组展品样式
      } else {
        arr = initMaterialExhibitstyle(element, type, list[index - 1]); //设置当前分组展品样式
      }
    }

    list[index] = arr;
    // console.log(list[index])
    // }
  });
  // console.log(list)
  return list;
};
const SetauxiliaryDataStyle = (data, AllId?: number) => {
  let list = _.cloneDeep(data);
  //设置辅助信息样式 AllId :选中应用到全部的id
  if (!AllId) {
    list.forEach((element, index) => {
      // if (element.type === 0) {
      //循环判断设置每一个的动态参数
      element.type = element.type ? element.type : setOutlineStyle(1, 4);
      let level1auxiliaryList = setShowpieceListType(element.showpieceList, AllId); //设置辅助信息样式
      list[index].showpieceList = level1auxiliaryList;
      // console.log('设置辅助信息',level1auxiliaryList)
      // }
    });
  } else {
    list.forEach((element, index) => {
      // if (element.type === 0) {
      //循环判断设置每一个的动态参数
      element.type = element.type = AllId;
    });
  }

  return list;
};
const SetauxiliaryDataStyleAll = (data, AllId?: number) => {
  let list = _.cloneDeep(data);
  ////设置辅助信息样式内所有展品id
  list.forEach((element, index) => {
    // if (element.type === 0) {
    //循环判断设置每一个的动态参数
    let level1auxiliaryList = setShowpieceListType(element.showpieceList, AllId); //设置辅助信息样式
    list[index].showpieceList = level1auxiliaryList;
    // console.log('设置辅助信息',level1auxiliaryList)
    // }
  });

  return list;
};
export const SetfreeDataStyle = (data) => {
  //设置获取的自由模式大纲列表
  let list = _.cloneDeep(data);
  if (!list) {
    return;
  }
  list.forEach((level1, index) => {
    if (level1.type === 0) {
      level1.type = setOutlineStyle(1, 1); //设置当前大纲样式
    }
    let level1auxiliaryList = SetauxiliaryDataStyle(level1.auxiliaryList); //设置辅助信息样式
    let level1showpieceList = setShowpieceListType(level1.showpieceList); //设置展品样式
    level1.auxiliaryList = level1auxiliaryList;
    level1.showpieceList = level1showpieceList;
    level1.isShow = true;
    // if (index === 0) {
    //
    // } else {
    //   level1.isShow = false;
    // }
    level1.children.forEach((level2) => {
      if (level2.type === 0) {
        level2.type = setOutlineStyle(1, 2); //设置当前大纲样式
      }
      let level2auxiliaryList = SetauxiliaryDataStyle(level2.auxiliaryList); //设置辅助信息样式
      let level2showpieceList = setShowpieceListType(level2.showpieceList); //设置展品样式
      level2.auxiliaryList = level2auxiliaryList; //设置辅助信息样式
      level2.showpieceList = level2showpieceList;
      level2.children.forEach((level3) => {
        if (level3.type === 0) {
          level3.type = setOutlineStyle(1, 3); //设置当前大纲样式
        }
        let level3auxiliaryList = SetauxiliaryDataStyle(level3.auxiliaryList); //设置辅助信息样式
        let level3showpieceList = setShowpieceListType(level3.showpieceList); //设置展品样式
        level3.auxiliaryList = level3auxiliaryList; //设置辅助信息样式
        level3.showpieceList = level3showpieceList; //设置展品样式
      });
    });
  });

  return list;
};
// const SetAllauxiliaryDataStyle = (data, AllId?: number) => {
//   //设置辅助信息样式 AllId :选中应用到全部的id
//   let list = _.cloneDeep(data);

//   list.forEach((element, index) => {
//     // if (element.type === 0) {
//     //循环判断设置每一个的动态参数
//     element.type = element.type ? element.type : setOutlineStyle(1, 4);
//     let level1auxiliaryList = setShowpieceListType(element.showpieceList, AllId); //设置辅助信息样式
//     list[index].showpieceList = level1auxiliaryList;
//     // console.log('设置辅助信息',level1auxiliaryList)
//     // }
//   });

//   return list;
// };
export const SetspecifyfreeExhibitStyle = (data: any, type: number, idVlaue: number) => {
  //设置所有展品的应用为同一类型 type 1 1级大纲 2 2级大纲 3 3级大纲 4 辅助信息 5 展品
  //设置所有展品的应用为同一类型 type 1 1级大纲 2 2级大纲 3 3级大纲 4 辅助信息 5 展品
  let list = _.cloneDeep(data);
  if (!list) {
    return;
  }
  list.forEach((level1, index) => {
    if (type === 1) {
      level1.type = idVlaue;
    }
    if (type === 4) {
      let level1auxiliaryList = SetauxiliaryDataStyle(level1.auxiliaryList, idVlaue); //设置辅助信息样式
      level1.auxiliaryList = level1auxiliaryList;
      // level1.showpieceList.forEach((element) => {
      //   element.type = idVlaue;
      // });
    }
    if (type === 5) {
      let level1auxiliaryList = SetauxiliaryDataStyleAll(level1.auxiliaryList, idVlaue); //设置辅助信息样式
      let level1showpieceList = setShowpieceListType(level1.showpieceList, idVlaue); //设置展品样式
      level1.auxiliaryList = level1auxiliaryList;
      level1.showpieceList = level1showpieceList;
    }

    level1.children.forEach((level2) => {
      if (type === 2) {
        level2.type = idVlaue;
      }
      if (type === 4) {
        let level2auxiliaryList = SetauxiliaryDataStyle(level2.auxiliaryList, idVlaue); //设置辅助信息样式
        level2.auxiliaryList = level2auxiliaryList; //设置辅助信息样式
        // level2.showpieceList.forEach((element) => {
        //   element.type = idVlaue;
        // });
      }
      if (type === 5) {
        let level2auxiliaryList = SetauxiliaryDataStyleAll(level2.auxiliaryList, idVlaue); //设置辅助信息样式
        let level2showpieceList = setShowpieceListType(level2.showpieceList, idVlaue); //设置展品样式
        level2.auxiliaryList = level2auxiliaryList; //设置辅助信息样式
        level2.showpieceList = level2showpieceList;
      }

      level2.children.forEach((level3) => {
        if (type === 3) {
          level3.type = idVlaue;
        }
        if (type === 4) {
          let level3auxiliaryList = SetauxiliaryDataStyle(level3.auxiliaryList, idVlaue); //设置辅助信息样式
          level3.auxiliaryList = level3auxiliaryList; //设置辅助信息样式
          // level3.showpieceList.forEach((element) => {
          //   element.type = idVlaue;
          // });
        }
        if (type === 5) {
          let level3auxiliaryList = SetauxiliaryDataStyleAll(level3.auxiliaryList, idVlaue); //设置辅助信息样式
          let level3showpieceList = setShowpieceListType(level3.showpieceList, idVlaue); //设置展品样式
          level3.auxiliaryList = level3auxiliaryList; //设置辅助信息样式
          level3.showpieceList = level3showpieceList; //设置展品样式
        }
      });
    });
  });

  return list;
};
export const filterFreeData = (data: any) => {
  //过滤所有不需要保存的参数
  let clonedObject = _.cloneDeep(data);

  // SavefreeData
  clonedObject.forEach((element) => {
    element.text = '';
    element.value = '';
    element.remarks = '';
    element.auxiliaryList.forEach((auxiliary) => {
      auxiliary.text = '';
      auxiliary.value = '';
      auxiliary.remarks = '';
      auxiliary.audio = null;
    });
    element.children.forEach((el) => {
      el.text = '';
      el.value = '';
      el.remarks = '';
      el.auxiliaryList.forEach((auxiliary1) => {
        auxiliary1.text = '';
        auxiliary1.value = '';
        auxiliary1.remarks = '';
        auxiliary1.audio = null;
      });
      el.children.forEach((arr) => {
        arr.text = '';
        arr.value = '';
        arr.remarks = '';
        arr.auxiliaryList.forEach((auxiliary2) => {
          auxiliary2.text = '';
          auxiliary2.value = '';
          auxiliary2.remarks = '';
          auxiliary2.audio = null;
        });
      });
    });
  });
  return clonedObject;
};
export const CancatExhibitList = (oldlist: Array<any>, list: Array<any>) => {
  let clonedObject = _.cloneDeep(oldlist);
  list.forEach((element) => {
    clonedObject.push(element);
  });
  console.log(clonedObject);
  return clonedObject;
};
export const AddXNumberExhibitList = (list: Array<any>, index: number, add: number) => {
  let clonedObject = _.cloneDeep(list);
  clonedObject.forEach((element) => {
    if (element.x > list[index].x) {
      element.x = element.x + add;
    }
  });

  return clonedObject;
};
export const exportActiveExhibitListInfo = (type) => {
  let arr;
  ExhibitionList.forEach((el) => {
    if (el.id === type) {
      arr = el;
    }
  });
  return arr;
};
export const restshowpieceListStyle = (data: any, ActiveIId: number) => {
  //设置当前单元所有展品的列表重新排序 除展柜以外的所有展品类别
  let typeInfo = exportActiveExhibitListInfo(ActiveIId); //获取type详情信息
  let list = _.cloneDeep(data); //克隆单元展品数组
  list.forEach((element, index) => {
    //循环判断重新赋值 将同类型的type数据重新赋值给每个展品分组
    element.y = typeInfo.y;
    element.height = typeInfo.height;
    element.showpieceList.forEach((elements) => {
      elements.imgWidth = typeInfo.CoverWidth;
      elements.imgHeight = typeInfo.CoverHeight;
      elements.width = typeInfo.CoverWidth;
      elements.height = typeInfo.CoverHeight;
    });
    element.width = typeInfo.width + typeInfo.CoverWidth * element.showpieceList.length; //逻辑计算宽度等于基础宽度*所有展品数量

    if (index === 0) {
      element.x = 0; //如果下标为0的话x为初始位置
    } else {
      // console.log(list[index - 1])
      element.x = list[index - 1].width + list[index - 1].x; //下表为上一个x坐标+上一个的宽度
    }
  });
  return list;
};
